package com.alliky.classify.ui.viewmodel;

import android.graphics.drawable.Drawable;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.databinding.ObservableField;

import com.alliky.classify.R;
import com.alliky.core.entity.vo.GoodsVO;
import com.alliky.core.base.ItemViewModel;

import org.jetbrains.annotations.NotNull;

/**
 * @Author: wxianing
 * @CreateDate: 2022/6/25 15:38
 * @Description: java类作用描述
 */
public class ClassifyItemContentViewModel extends ItemViewModel<ClassifyViewModel> {

    public ObservableField<GoodsVO> mField = new ObservableField<>();

    public Drawable drawableImg;

    public ClassifyItemContentViewModel(@NonNull @NotNull ClassifyViewModel viewModel, GoodsVO goodsVO) {
        super(viewModel);
        mField.set(goodsVO);
        //ImageView的占位图片，可以解决RecyclerView中图片错误问题
        drawableImg = ContextCompat.getDrawable(viewModel.getApplication(), R.mipmap.icon_default);
    }
}
